.form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
    background-color: inherit;
    max-width: 100%;
}

/* Form groups (inputs + labels) */

.form__group {
    background-color: inherit;
    position: relative;
    margin-top: 0 !important; /* Can be removed once site-wide <p> styles are removed */
}

/* Form labels */

.form__label {
    user-select: none;
    font-size: 14px;
    font-weight: normal !important; /* Needed until site-wide <label> styles are removed */
}

.form__label--floating {
    background-color: inherit;
    border-radius: 50% 50% 0 0 / 8px;
    cursor: text;
    height: auto;
    line-height: 1;
    position: absolute;
    padding: 8px 4px 0 4px;
    display: inline-block;
    top: 6px;
    left: 8px;
    color: var(--textarea-border);

    @media screen and (prefers-reduced-motion: no-preference) {
        transition: top 400ms cubic-bezier(0.25, 0.8, 0.25, 1), font-size 400ms cubic-bezier(0.25, 0.8, 0.25, 1),
            color 400ms cubic-bezier(0.25, 0.8, 0.25, 1);
    }
}

/* Buttons */

.form__button {
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    margin: 6px;
    padding: 8px 12px;
    border-radius: 9999px;
    align-self: flex-start;
    transition: filter 300ms;

    &:hover {
        filter: brightness(1.1);
    }

    &:active {
        filter: brightness(0.9);
        transition: none;
    }
}

.form__button--filled {
    background: var(--button-filled-bg);
    color: var(--button-filled-fg);
    border: 0;
}

.form__button--text {
    background: var(--button-text-bg);
    color: var(--button-text-fg);
    border: 0;
}

/* Textareas */

.form__textarea {
    background-color: inherit;
    border: 1px solid var(--textarea-border);
    width: 100%;
    max-width: 100%;
    height: 40px;
    padding: 12px;
    border-radius: 5px;
    outline: none;
    font-size: 14px;
    font-weight: normal;

    @media screen and (prefers-reduced-motion: no-preference) {
        transition: border-color 600ms cubic-bezier(0.25, 0.8, 0.25, 1), height 600ms cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    &:hover {
        border: 2px solid var(--textarea-border-hover);
    }

    &:focus,
    &:focus:hover {
        border: 2px solid var(--textarea-border-active);
        height: 140px;

        & + .form__label--floating {
            top: -11px;
            font-size: 11px;
            color: #2196f3;
        }
    }

    &:valid {
        height: 140px;

        & + .form__label--floating {
            top: -11px;
            font-size: 11px;
        }
    }

    &:invalid:focus {
        border: 1px solid #ba1b1b;

        & + .form__label--floating {
            color: #ba1b1b;

            > strong {
                color: inherit; /* Can be removed once site-wide <strong> styling is removed */
            }
        }

        & ~ .form__hint {
            color: #ba1b1b;
            font-size: 12px;
            margin-left: 16px;

            > strong {
                color: inherit; /* Can be removed once site-wide <strong> styling is removed */
            }
        }
    }
}

/* Checkboxes */

.form__checkbox {
    all: revert !important; /* Can be removed once site-wide checkbox styling is removed */
}
